<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page isELIgnored ="false"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="${basePath}style.css">
    <link rel="stylesheet" href="${basePath}font-awesome-4.7.0/css/font-awesome.min.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
      $(function(){
        $('.remove').click(function(){
          if(confirm("确定要删除吗？")){
            window.location.href="${basePath}course?method=delete&id="+$(this).attr("keyword");
          }
        })
      })
    </script>
</head>
<body>
<form action="${basePath}course?method=list" method="post">
  <div class="condition">
    课程ID：<input type="text" name="courseId" value="${course.courseId}">
    课程名称：<input type="text" name="courseName" value="${course.courseName}">
    任课教师：<input type="text" name="teaName" value="${course.teacher.teaName}">
    <button>
      <i class="fa fa-search"></i>
      查询
    </button>
    <button type="button" onclick="window.location.href='course?method=v_add'">
      <i class="fa fa-plus"></i>
      新增
    </button>
  </div>
</form>
<form action="${basePath}course?method=list" id="tableList" method="post">
  <input type="hidden" name="pageNo" value="${pageInfo.pageNo}">
  <input type="hidden" name="courseId" value="${course.courseId}">
  <input type="hidden" name="courseName" value="${course.courseName}">
  <input type="hidden" name="teaName" value="${course.teacher.teaName}">
  <input type="hidden" name="teaUsername" value="${course.teacher.teaUsername}">
  <table class="tablelist">
    <thead>
    <tr>
      <th>课程ID</th>
      <th>课程名称</th>
      <th>任课教师</th>
      <th width="160px">操作</th>
    </tr>
    </thead>

    <c:forEach  items="${pageInfo.list}" var="course">
      <tr>
        <td>${course.courseId}</td>
        <td>${course.courseName}</td>
        <td>${course.teacher.teaName}</td>
        <td>
          <button class="edit" type="button" onclick="window.location.href='${basePath}course?method=edit&id=${course.courseId}'">
            <i class="fa fa-edit"></i>
            修改
          </button>
          <button class="remove" type="button" keyword="${course.courseId}">
            <i class="fa fa-remove"></i>
            删除
          </button>
        </td>
      </tr>
    </c:forEach>
  </table>
  <%@include file="../page.jsp"%>
</form>
</body>


</html>
